/*
 * Copyright 2019 Patrik Karlström.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package se.trixon.almond.util.swing.dialogs;

import javax.swing.ImageIcon;
import se.trixon.almond.util.AlmondOptions;
import se.trixon.almond.util.icons.material.swing.MaterialIcon;

/**
 *
 * @author Patrik Karlström
 */
public class NotificationLine extends javax.swing.JPanel {

    private final AlmondOptions mOptions = AlmondOptions.getInstance();
    private final int ICON_SIZE = 16;

    /**
     * Creates new form NotificationLine
     */
    public NotificationLine() {
        initComponents();
    }

    public void displayErrorMessage(String string) {
        display(MaterialIcon._Alert.ERROR_OUTLINE.getImageIcon(ICON_SIZE), string);
    }

    public void displayInformationMessage(String string) {
        display(MaterialIcon._Action.INFO_OUTLINE.getImageIcon(ICON_SIZE), string);
    }

    public void displayWarningMessage(String string) {
        display(MaterialIcon._Alert.WARNING.getImageIcon(ICON_SIZE), string);
    }

    private void display(ImageIcon imageIcon, String string) {
        label.setIcon(imageIcon);
        label.setText(string);
    }

    /**
     * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this method is always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        label = new javax.swing.JLabel();

        label.setText("notification"); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(label, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(label)
                .addGap(0, 0, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel label;
    // End of variables declaration//GEN-END:variables
}
